package com.test.dao;


import com.test.entity.InfoDto;

public class InfoDaoProvider {

    public String insertReleaseInfo(InfoDto infoDto){
        StringBuilder sql = new StringBuilder();
        sql.append(" insert into table_releasejob_info(recruit_time,recruit_name,recruit_address,recruit_job,recruit_material,recruit_people,recruit_peopletel,recruit_salary,recruit_updatetime,u_acount) values( ");
        if(infoDto.getRecruit_time()!=null&&!"".equals(infoDto.getRecruit_time())){
            sql.append("'"+infoDto.getRecruit_time()+"',");
        }else{
            sql.append("'"+0+"',");
        }
        if(infoDto.getRecruit_name()!=null&&!"".equals(infoDto.getRecruit_name())){
            sql.append("'"+infoDto.getRecruit_name()+"',");
        }else{
            sql.append("'"+0+"',");
        }

        if(infoDto.getRecruit_address()!=null&&!"".equals(infoDto.getRecruit_address())){
            sql.append("'"+infoDto.getRecruit_address()+"',");
        }else{
            sql.append("'"+0+"',");
        }
        if(infoDto.getRecruit_job()!=null&&!"".equals(infoDto.getRecruit_job())){
            sql.append("'"+infoDto.getRecruit_job()+"',");
        }else{
            sql.append("'"+0+"',");
        }
        if(infoDto.getRecruit_material()!=null&&!"".equals(infoDto.getRecruit_material())){
            sql.append("'"+infoDto.getRecruit_material()+"',");
        }else{
            sql.append("'"+0+"',");
        }

        if(infoDto.getRecruit_people()!=null&&!"".equals(infoDto.getRecruit_people())){
            sql.append("'"+infoDto.getRecruit_people()+"',");
        }else{
            sql.append("'"+0+"',");
        }

        if(infoDto.getRecruit_peopletel()!=null&&!"".equals(infoDto.getRecruit_peopletel())){
            sql.append("'"+infoDto.getRecruit_peopletel()+"',");
        }else{
            sql.append("'"+0+"',");
        }


        if(infoDto.getRecruit_salary()!=null&&!"".equals(infoDto.getRecruit_salary())){
            sql.append("'"+infoDto.getRecruit_salary()+"',");
        }else{
            sql.append("'"+0+"',");
        }

        sql.append("now(),");
        if(infoDto.getU_acount()!=null&&!"".equals(infoDto.getU_acount())){
            sql.append("'"+infoDto.getU_acount()+"'");
        }else{
            sql.append("'"+0+"'");
        }
        sql.append(")");
        return sql.toString();
    }

    public String selectReleaseInfo(String acount){
        StringBuilder sql = new StringBuilder();
        sql.append(" SELECT recruit_time,recruit_name,recruit_address,recruit_job,recruit_material,u_acount  from table_releasejob_info ");
        sql.append(" where 1=1");
        if(acount!=null&&!"".equals(acount)){
            sql.append("  and u_acount = '"+acount+"'");
        }else{
            sql.append("  and u_acount = '"+0+"'");
        }
        return sql.toString();
    }

}
